#include "login_register_ui.h"

LoginRegisterUi::LoginRegisterUi(QWidget *parent)
    : QWidget(parent)
{
    setupLoginUi();
}

void LoginRegisterUi::setupLoginUi()
{
    setWindowTitle(tr("Login"));

    usernameEdit = new QLineEdit(this);
    passwordEdit = new QLineEdit(this);
    passwordEdit->setEchoMode(QLineEdit::Password);
    loginButton = new QPushButton(tr("登录"), this);
    registerButton = new QPushButton(tr("注册"), this);
    forgotPasswordButton = new QPushButton(tr("忘记密码"), this);

    QFormLayout *formLayout = new QFormLayout;
    formLayout->addRow(tr("手机号/邮箱:"), usernameEdit);
    formLayout->addRow(tr("密码:"), passwordEdit);

    QGridLayout *buttonLayout = new QGridLayout;
    buttonLayout->addWidget(loginButton, 0, 0);
    buttonLayout->addWidget(registerButton, 0, 1);
    buttonLayout->addWidget(forgotPasswordButton, 1, 0, 1, 2);

    // 将布局添加到主布局
    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->addLayout(formLayout);
    mainLayout->addLayout(buttonLayout);

    setLayout(mainLayout);
}
